package com.letoy.edu.controller;

import com.letoy.edu.service.CourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@Api(value = "课程信息管理", tags = "课程信息API")
public class CourseController {

    @Autowired
    CourseService courseService;

    @GetMapping("/test")
    @ApiOperation(value = "测试", notes = "测试api")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> test() {
        Map<String, Object> mapper = new HashMap<>();
        mapper.put("status", "success");
        return mapper;
    }


    @PostMapping("/course/findAllCourse")
    @ApiOperation(value = "课程信息查询所有", notes = "课程信息表表查询所有")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> findAllCourse() {

        return courseService.findAllCourse();
    }

    @PostMapping("/course/findAllCourseIncludeTime")
    @ApiOperation(value = "课程信息查询所有(有上下课时间)", notes = "课程信息表表查询所有")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private HashMap<String, Object> findAllCourseIncludingTime() {

        return courseService.findAllCourseIncludingTime();
    }


}
